﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="admin_usermgr.aspx.cs" Inherits="admin_usermgr"  MasterPageFile="Admin.master"%>
<asp:Content ContentPlaceHolderID="main_style" runat="server">
    <link href="Styles/album.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ContentPlaceHolderID="main_left" runat="server">
    <form id="form1" runat="server">
    <h1>用户管理</h1>
    <br/>
    <h2>管理员可以查看所有用户的信息，并可以更改用户的权限</h2>
    <asp:GridView ID="GridView1" DataSourceID="mysource" DataKeyNames="uid" 
        AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" runat="server" 
        Width="800px" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" 
        GridLines="Vertical">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="uid" HeaderText="用户id" InsertVisible="False" 
                ReadOnly="True" SortExpression="uid" />
            <asp:BoundField DataField="username" HeaderText="注册邮箱" 
                ReadOnly="True" SortExpression="username" />
            <asp:BoundField DataField="nickname" HeaderText="昵称" 
               ReadOnly="True"  SortExpression="nickname" />
            <asp:BoundField DataField="time" HeaderText="注册时间" SortExpression="time" ReadOnly="True" />
            <asp:BoundField DataField="role" HeaderText="权限(1为管理员)" SortExpression="role"></asp:BoundField>
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#F7F7DE" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#FBFBF2" />
        <SortedAscendingHeaderStyle BackColor="#848384" />
        <SortedDescendingCellStyle BackColor="#EAEAD3" />
        <SortedDescendingHeaderStyle BackColor="#575357" />
    </asp:GridView>
        <asp:SqlDataSource ID="mysource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:photoGalleryConnectionString %>" 
        DeleteCommand="DELETE FROM [user] WHERE [uid] = @uid" 
        SelectCommand="SELECT * FROM [user]" 
        UpdateCommand="UPDATE [user] SET [role] = @role WHERE [uid] = @uid" >
            <DeleteParameters>
                <asp:Parameter Name="uid" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="role" Type="Int32" />
                <asp:Parameter Name="uid" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </form>
</asp:Content>
<asp:Content ContentPlaceHolderID="main_right" runat="server">
    <div id="uploadlink" class="rblock" runat="server">
        <div class="title1">&gt;<a href="admin_pic.aspx">图片管理</a></div>
        <div class="title1">&gt;<a href="admin_usermgr.aspx">用户管理</a></div>
        <div class="title1">&gt;<a href="admin_message.aspx">消息管理</a></div>
        <div class="title1">&gt;<a href="admin_personal.aspx">修改密码</a></div>
    </div>
</asp:Content>